/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import entity.Faq;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.DataModel;
import model.FaqFacade;
import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;

/**
 *
 * @author VietTien
 */
@ManagedBean
@SessionScoped
public class FAQController implements Serializable {

    @EJB
    private FaqFacade faqFacade;
    private DataModel items = null;//Lay list event
    private List<Faq> faqList;

    /** Creates a new instance of FAQController */
    public FAQController() {
//        root = new DefaultTreeNode("Root", null);
//        List<Faq> rootNodes = faqFacade.findAll();
//
//        Iterator it = rootNodes.iterator();
//         Faq result = (Faq) it.next();
//            TreeNode node1 = new DefaultTreeNode(result.getQuestion(), root);
////        while (it.hasNext()) {
////            Faq result = (Faq) it.next();
////            TreeNode node1 = new DefaultTreeNode(result.getQuestion(), root);
////            break;
////        }

    }
    private TreeNode root;
    private TreeNode selectedNode;

    public TreeNode getRoot() {
        return root;
    }

    public TreeNode getSelectedNode() {
        return selectedNode;
    }

    public void setSelectedNode(TreeNode selectedNode) {
        this.selectedNode = selectedNode;
    }
}
